jQuery(document).ready(function($) {
	$('ul li:last-child').addClass('lastItem');
	$('ul li:first-child').addClass('firstItem');

	$('#rt-sidebar-a > div:last-child, #rt-sidebar-b > div:last-child, #rt-sidebar-c > div:last-child').addClass('lastItem');

	
/*ScrollToTop button*/
	$(function() {
		$(window).scroll(function() {
			if($(this).scrollTop() != 0) {
				$('.rt-block.totop').fadeIn();	
			} else {
				$('.rt-block.totop').fadeOut();
			}
		});
	});
	
/*Avoid input bg in Chrome*/
	if ($.browser.webkit) {
		$.browser.safari = ( $.browser.safari && /chrome/.test(navigator.userAgent.toLowerCase()) ) ? false : true;
		$('input').attr('autocomplete', 'off');
		$('ul.sf-menu li > .sf-holder,div.itemImageBlock a,a.moduleItemImage,div.catItemImageBlock a,div.userItemImageBlock a,div.genericItemImageBlock a,a.moduleItemReadMore,a.k2ReadMore,.component-content div.toggle-editor a,a.moduleCustomLink').prepend('<span class="before"></span>')
		if ($.browser.safari) {$('ul.sf-menu li > .sf-holder,div.itemImageBlock a,a.moduleItemImage,div.catItemImageBlock a,div.userItemImageBlock a,div.genericItemImageBlock a,a.moduleItemReadMore,a.k2ReadMore,.component-content div.toggle-editor a,a.moduleCustomLink').addClass('safari')}
	}
	if ($.browser.msie&&$.browser.version<9) {
		$('ul.sf-menu li > .sf-holder,div.itemImageBlock a,a.moduleItemImage,div.catItemImageBlock a,div.userItemImageBlock a,div.genericItemImageBlock a,a.moduleItemReadMore,a.k2ReadMore,.component-content div.toggle-editor a,a.moduleCustomLink').prepend('<span class="before"></span>')
	}
	
/*Zoom Icon. Portfolio page*/

	$(function(){
	// IPad/IPhone
		var viewportmeta = document.querySelector && document.querySelector('meta[name="viewport"]'),
		ua = navigator.userAgent,

		gestureStart = function () {viewportmeta.content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6";},

		scaleFix = function () {
			if (viewportmeta && /iPhone|iPad/.test(ua) && !/Opera Mini/.test(ua)) {
				viewportmeta.content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
				document.addEventListener("gesturestart", gestureStart, false);
			}
		};
		
		scaleFix();
		// Menu Android
			/*var userag = navigator.userAgent.toLowerCase();
			var isAndroid = userag.indexOf("android") > -1; 
			if(isAndroid) {
				$('.sf-menu').responsiveMenu({autoArrows:true});
			}*/
	});
	
/*Pagination Active Button*/
	$('.k2Pagination ul li:not([class])').addClass('num');
	$('div.pagination ul li:not([class])').addClass('num');	
	$('div.itemCommentsPagination ul li:not([class])').addClass('num');	

/*Showcase Item Animation*/

});